package com.htj.bookreview.service.Impl;

import com.htj.bookreview.mapper.UserMapper;
import com.htj.bookreview.entity.User;
import com.htj.bookreview.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceIpml implements UserService {

    @Autowired(required = false)
    private UserMapper mapper;
    @Override
    public User loginIn(String name, String password) {
        return mapper.getInfo(name,password);
    }

    @Override
    public User queryUserById(String id) {
        return mapper.selectUserById(id);
    }

    @Override
    public int addUser(User user) {
        int aFlag = mapper.insertUser(user);
        return aFlag;
    }

    @Override
    public int dropUser(String id) {
        int dFlag = mapper.deleteUser(id);
        return dFlag;
    }

    @Override
    public int modifyUser(User user) {
        int mFlag = mapper.updateUser(user);
        return mFlag;
    }

    @Override
    public List<User> queryAllUser() {
        return mapper.getAllUser();
    }
}
